package com.mck.mapper;

import com.mck.entity.Classname;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @version 1.0.0
 * @Author mck
 * @Date 2025/1/27 下午5:34
 * @注释
 */

@Mapper
public interface ClassnameMapper {
    /**
     * 获取班级列表
     */
    // @Select("select id, academy, major, grade, classname, counsellor_id, phone_number, create_time, update_time from classname")
    List<Classname> getClassnameList();

    /**
     * 根据id获取班级信息
     */
    @Select("select class_id, level, academy, major, grade, classname, create_time, update_time from classnames where class_id = #{classId}")
    Classname getClassnameById(Integer classId);

    /**
     * 添加班级
     */
    @Insert("insert into classnames(level, academy, major, grade, classname, create_time) values(#{level}, #{academy}, #{major}, #{grade}, #{classname}, #{createTime})")
    void addClassname(Classname classname);

    /**
     * 更新班级
     */
    @Update("update classnames set academy = #{academy}, major = #{major}, grade = #{grade}, classname = #{classname}, update_time = #{updateTime} where class_id = #{class_id}")
    void updateClassname(Classname classname);

    /**
     * 删除班级
     */
    @Delete("delete from classnames where class_id = #{class_id}")
    void deleteClassname(Integer id);

}
